﻿using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.Text.Json.Serialization;

namespace CssoftService
{
    class Program
    {
        static void Main(string[] args)
        {
            var kpairList = new List<KeyValuePair<string, string>>();
            //kpairList["t"] = 1;
            kpairList.Add(new KeyValuePair<string, string>("a", "1"));
            kpairList.Add(new KeyValuePair<string, string>("b", "2"));
            kpairList.Add(new KeyValuePair<string, string>("c", "3"));
            kpairList.Add(new KeyValuePair<string, string>("d", "4"));
            kpairList.Add(new KeyValuePair<string, string>("e", "5"));
            var list = new List<dynamic>();
            list = JsonConvert.DeserializeObject<List<object>>(JsonConvert.SerializeObject(kpairList));

            foreach (var item in list)
            {
                Console.WriteLine(item);

            }
            Console.WriteLine("");
            var tPairList = JsonConvert.DeserializeObject<List<KeyValuePair<string, string>>>(JsonConvert.SerializeObject(kpairList));
            foreach (var item in tPairList)
            {
                Console.WriteLine(item);
                Console.WriteLine(item.Key);
                Console.WriteLine(item.Value);

            }

            //Console.WriteLine("Hello World!");
            Console.ReadKey();
        }
    }
}
